<?php
namespace app\servergoods\validate;
use \app\manage\validate\BaseValidate;

class GoodsCategoryAttrs extends BaseValidate
{
    //添加和编辑的时候的验证规则
	protected $rule =   [
        'id'    => ['integer','gt'=>0],
        'name'  => ['length'=>'2,25'],
        'en_name'  => ['length'=>'2,25'],
        'attr_type'  => ['in'=>'1,2,3,4,5,6'],
        'is_filter'  => ['in'=>'0,1'],
        'show_position'  => ['in'=>'main,secondary'],
        'search_flag'  => ['in'=>'integer,none'],
        'is_show'  => ['in'=>'0,1'],
        'order'  => ['integer','gt'=>0],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50],
    ];

    protected $message  =   [
        'name' => '名称长度在2-25之间',
        'en_name' => '英文展示名称长度在2-25之间',
        'attr_type.in' => '属性类型不正确',
        'is_filter' => '请选择是否参与筛选',
        'show_position.in' => '选择所显示的位置',
        'search_flag.in' => '关联字段错误',
        'is_show' => '选择是否在显示在商品属性中',
        'order.integer' => '排序为整数',
        'page' => '当前页为大于0的整数',
        'listRows' => '每页显示的条数范围为1-50',
    ];

    protected $scene = [
        'checkId' => ['id'],
        'checkIdArray' => [
            'id'  => ['require','array','min'=>1],
        ],
        'attrsAllList'=>['attr_type'],
        'getSomeAttrs'=>['en_name'=>['require','min'=>2]],
        'oneAttrInfo' =>['id', 'en_name'],
    ];

}